package com.hps.demo.msg;

import org.apache.rocketmq.spring.core.RocketMQTemplate;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

/**
 * @author heps
 * @since 2020/7/23 10:02
 */
@Component
public class OrderTopicProducer {

  private RocketMQTemplate rocketMQTemplate;

  @Value("${rocketmq.topic.order}")
  private String topic;

  public OrderTopicProducer(RocketMQTemplate rocketMQTemplate) {
    this.rocketMQTemplate = rocketMQTemplate;
  }

  public void send(String msg) {
    rocketMQTemplate.convertAndSend(topic, msg);
  }
}
